package com.health_predict_springboot.service.impl;

import com.health_predict_springboot.dao.SysPopupConfigMapper;
import com.health_predict_springboot.pojo.SysPopupConfig;
import com.health_predict_springboot.service.SysPopupConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SysPopupConfigServiceImpl implements SysPopupConfigService {

    @Autowired
    private SysPopupConfigMapper sysPopupConfigMapper;

    @Override
    public SysPopupConfig getPopupConfigById(Integer configId) {
        return sysPopupConfigMapper.selectByConfigId(configId);
    }

    @Override
    public List<SysPopupConfig> getAllPopupConfigs() {
        return sysPopupConfigMapper.selectAllPopupConfigs();
    }

    @Override
    public boolean addPopupConfig(SysPopupConfig popupConfig) {
        return sysPopupConfigMapper.insertPopupConfig(popupConfig) > 0;
    }

    @Override
    public boolean updatePopupConfig(SysPopupConfig popupConfig) {
        return sysPopupConfigMapper.updatePopupConfig(popupConfig) > 0;
    }

    @Override
    public boolean deletePopupConfig(Integer configId) {
        return sysPopupConfigMapper.deletePopupConfig(configId) > 0;
    }

    @Override
    public List<SysPopupConfig> getPopupConfigsByPage(Map<String, Object> params) {
        return sysPopupConfigMapper.selectPopupConfigsByPage(params);
    }

    @Override
    public int getPopupConfigCount(Map<String, Object> params) {
        return sysPopupConfigMapper.selectPopupConfigCount(params);
    }

    @Override
    public SysPopupConfig getActivePopupConfig() {
        return sysPopupConfigMapper.selectActivePopupConfig();
    }
}